import 'package:flutter_shop/pages/member/select_people/entity/people_info.dart';
import 'package:flutter_shop/widget/tree_select/tree_node.dart';

peopleInfoFromJson(PeopleInfo data, Map<String, dynamic> json) {
	if (json['Id'] != null) {
		data.Id = json['Id']?.toString();
	}
	if (json['Name'] != null) {
		data.Name = json['Name']?.toString();
	}
	if (json['Category'] != null) {
		data.Category = json['Category']?.toString();
	}
	if (json['ParentId'] != null) {
		data.ParentId = json['ParentId']?.toString();
	}
	if (json['DutyPerson'] != null) {
		data.DutyPerson = json['DutyPerson']?.toString();
	}
	if (json['Children'] != null) {
		data.Children = new List<PeopleInfo>();
		(json['Children'] as List).forEach((v) {
			data.Children.add(new PeopleInfo().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> peopleInfoToJson(PeopleInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['Id'] = entity.Id;
	data['Name'] = entity.Name;
	data['Category'] = entity.Category;
	data['ParentId'] = entity.ParentId;
	data['DutyPerson'] = entity.DutyPerson;
	if (entity.Children != null) {
		data['Children'] =  entity.Children.map((v) => v.toJson()).toList();
	}
	return data;
}